package com.bruce.pattern.behavioral.chain.demo1;

import com.bruce.pattern.behavioral.chain.Course;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by bruce on 2018/11/11 18:16
 */
public class MainTest {

    @Test
    public void test1(){

        List<ChainHandler<Course>> handlers = new ArrayList<>();
        handlers.add(new ChainHandler1());
        handlers.add(new ChainHandler2());
        handlers.add(new ChainHandler3());

        Course course = new Course();
        course.setArticle("责任链模式文章");
        course.setName("责任链模式");
        course.setVideo("责任链模式视频");

        Chain<Course> chain = new Chain<>(handlers);
        chain.process(course);
    }






}
